import 'package:flutter/material.dart';

///
/// Stack API : https://api.flutter-io.cn/flutter/widgets/Stack-class.html
///
class DemoStack extends StatelessWidget {
  const DemoStack({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Column 布局',
      home: Scaffold(
        appBar: AppBar(
            title: const Text('垂直方向布局')
        ),
        body: const MyStack01(),
      ),
    );
  }
}


class MyStack01 extends StatelessWidget {
  const MyStack01({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var stack = Stack(
      alignment: const FractionalOffset(0.5, 0.9),
      children: [
        const CircleAvatar(
          backgroundImage: NetworkImage('https://i0.hdslb.com/bfs/face/23c68e9a1968a67ffbea9a20e64d04f75c42e2f2.jpg@240w_240h_1c_1s.webp'),
          radius: 100.0,
        ),
        Container(
          decoration: const BoxDecoration(
            color: Colors.lightBlue
          ),
          padding: const EdgeInsets.all(5.0),
          child: const Text('jsPang'),
        )
      ],
    );
    return Center(
      child: stack,
    );
  }
}




